Skip to content

Lightweight Choregraphic-programming based Multi-agent harness for effectful#607

Open
kiranandcode wants to merge 16 commits intomasterfrom
kg-multi-agent-epp
Open

Lightweight Choregraphic-programming based Multi-agent harness for effectful#607
kiranandcode wants to merge 16 commits intomasterfrom
kg-multi-agent-epp

Conversation

@kiranandcode
Copy link
Contributor

This PR implements the idea discussed with @eb8680 of using choreographic programming to implement a concise mechanism for specifying complex persistent programs.

def build_project(
    project_spec: str,
    architect: ArchitectAgent,
    coder: CoderAgent,
    reviewer: ReviewerAgent,
) -> list[ReviewResult]:
    """Choreographic program describing the full build workflow.

    1. Architect breaks the project into module specs.
    2. Coders implement modules in parallel (scatter distributes via claim-based pull).
    3. Reviewers review modules in parallel; coders fix in parallel until all pass.
    """
    # Step 1: Architect plans modules
    plan = architect.plan_modules(project_spec)
    modules = plan["modules"]

    # Step 2: Scatter implementation across coders
    scatter(modules,coder,lambda c, mod: c.implement_module(mod))

    # Step 3: Review loop
    while True:
        reviews = scatter(modules, reviewer,
            lambda r, mod: r.review_module(mod["module_path"], mod["test_path"]),
        )

        needs_fixes = [(mod, review)
            for mod, review in zip(modules, reviews)
            if review["verdict"] == "NEEDS_FIXES"
        ]

        if not needs_fixes:
            return reviews

        scatter(needs_fixes, coder,
            lambda c, (mod, review): c.implement_module(
                mod, fix_feedback=review["feedback"]
            )
        )

Describes a complex non-trivial multi-agent interaction of several agents with persistence, pull-based load balancing and agents with separate tasks, and a persistent task queue for resuming after crashes.

Addresses #603, Builds on top of #604, this also comes nicely full circle and provides a third stab at concurrency in effectful.

As always, concurrency is a boundless source of bugs and errors, so having a few extra eyes on this would be appreciated! I assume we'll have to iterate a bit on the design as well, but I'm very hopeful as to the direction this is going, because it seems to simplify a lot of annoying/hard-to-get-right boilerplate into a simple and concise mechanism!

kiranandcode and others added 6 commits March 11, 2026 12:11
…d docs

- Changed PersistenceHandler to accept db_path (Path to .db file) instead
  of persist_dir (directory), making the API explicit
- Removed in-memory caching of handoffs and loaded sets; all state is now
  read from/written to SQLite directly (thread-local loaded tracking remains)
- Made ensure_loaded and get_handoff private (_ensure_loaded, _get_handoff)
- Added crash recovery example to docstring
- Updated all tests to use new db_path API and reduced LLM call budgets
  for faster test execution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kiranandcode
Copy link
Contributor Author

Iterating on this design using https://github.com/kiranandcode/VerifiedJS/blob/main/agents/verified_compiler_agents.py as a testbed:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants